import request from './request/index';
import interfaceApi from './interfaceApi';
import type {
  HomeDataReq,
  HomeDataRes,
  DetailReq,
  DetailRes,
  HistoryReq,
  HistoryRes,
  HistoryDetailReq,
  HistoryDetailRes
} from '@/types/api.ts';

//  请求首页数据API
const reqHomeData = (param: HomeDataReq): Promise<HomeDataRes['data']> =>
  request.post(interfaceApi.homeData, param, {});

//  请求详情数据API
const reqDetail = (param: DetailReq): Promise<DetailRes['data']> =>
  request.post(interfaceApi.detail, param, {});

//  请求历史数据API
const reqHistory = (param: HistoryReq): Promise<HistoryRes['data']> =>
  request.post(interfaceApi.history, param, {});

//  请求历史详情数据API
const reqHistoryDetail = (param: HistoryDetailReq): Promise<HistoryDetailRes['data']> =>
  request.post(interfaceApi.historyDetail, param, {});

export { reqHomeData, reqDetail, reqHistory, reqHistoryDetail };
